import React,{Component} from 'react';
import TxtDetail from './txtDetail';
import ReplyList from './replyList';
import {connect} from 'react-redux';
import {getDetail} from '../../actions/details';
import data from './data';
class Details extends Component{
	// shouldComponentUpdate(nextProps,nextState){
		
	// }
	componentWillMount(){
		this.props.dispatch(getDetail(this.props.data, this.props.match.params.id));
	}
	render(){
		console.log(this.props)
		let {data,loading} = this.props;
		return(
			<div className="wrap">
				<TxtDetail data={data} loading={loading}/>
				<ReplyList 
					loading={loading}
					replies={data.replies}
					replyCount={data.reply_count}
				/>
			</div>
		)
	}
}
export default connect(state=>state.details)(Details);